<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('清单')" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m-t"  id="form-order-edit">
        <h4 class="form-header h4">货运订单信息</h4>
        <div class="container-div">
            <div class="row">
                <div class="col-sm-12 select-table table-striped">
                    <table id="bootstrap-table-two"></table>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="col-sm-12 select-table table-striped">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">总利润：</label>
            <div class="form-control-static" th:text="${totalProfit}">
            </div>
            <label class="col-sm-2 control-label">总提成：</label>
            <div class="form-control-static" th:text="${totalCommission}">
            </div>
        </div>
        <input id="ids" name="ids" th:value="${ids}" type="hidden">
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-select-js" />
<script th:inline="javascript">
    var prefix = ctx + "system/finance";
    $("#form-order-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/settlement", $('#form-order-edit').serialize());
        }
    }

    var datasPay = [[${@dict.getType('pay_type')}]];
    var datasType = [[${@dict.getType('order_type')}]];

    $(function() {
        var options = {
            data: [[${orderList}]],
            id: "bootstrap-table-two",
            pagination: false,
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            sidePagination: "client",
            columns: [
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'createUser',
                    title: '建单人'
                },
                {
                    field: 'vehicleInspector',
                    title: '提验人'
                },
                {
                    field: 'inspectionFee',
                    title: '提验费'
                },
                {
                    field: 'agencyFee',
                    title: '中介费'
                },
                {
                    field: 'userName',
                    title: '业务员'
                },
                {
                    field: 'profit',
                    title: '利润'
                },
                {
                    field: 'commission',
                    title: '业务员提成'
                },
                {
                    field: 'vehicleModel',
                    title: '车型'
                },
                {
                    field: 'vin',
                    title: '车架号'
                },
                {
                    field: 'client',
                    title: '托运人'
                },
                {
                    field: 'clientPhone',
                    title: '托运人电话'
                },
                {
                    field: 'origin',
                    title: '起始地'
                },
                {
                    field: 'dest',
                    title: '目的地'
                },
                {
                    field: 'receiver',
                    title: '接收人'
                },
                {
                    field: 'receiverPhone',
                    title: '接车人电话'
                },
                {
                    field: 'payType',
                    title: '支付方式',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(datasPay, value);
                    }
                },
                {
                    field: 'freightAmount',
                    title: '运费金额'
                },
                {
                    field: 'paidAmount',
                    title: '已付金额'
                },
                {
                    field: 'orderType',
                    title: '订单状态',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(datasType, value);
                    }
                },
                {
                    field: 'notes',
                    title: '备注'
                },
                {
                    field: 'createTime',
                    title: '建单时间'
                }]
        };
        $.table.init(options);
    });


    $(function() {
        var options = {
            data: [[${orderTransferList}]],
            pagination: false,
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            sidePagination: "client",
            columns: [
                {
                    field: 'id',
                    align: 'center',
                    title: "序号",
                    formatter: function (value, row, index) {
                        var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                        return columnIndex + $.table.serialNumber(index);
                    }
                },
                {
                    field: 'name',
                    align: 'center',
                    title: '中转段',
                },
                {
                    field: 'transporter',
                    align: 'center',
                    title: '驾驶员',
                },
                {
                    field: 'transporterPhone',
                    align: 'center',
                    title: '驾驶员电话',
                },
                {
                    field: 'plateNumber',
                    align: 'center',
                    title: '车牌号',
                },
                {
                    field: 'vehicleModel',
                    align: 'center',
                    title: '车型',
                },
                {
                    field: 'origin',
                    align: 'center',
                    title: '起始地',
                },
                {
                    field: 'dest',
                    align: 'center',
                    title: '目的地',
                },
                {
                    field: 'amount',
                    align: 'center',
                    title: '到收费用',
                },
                {
                    field: 'transferFee',
                    align: 'center',
                    title: '中转费',
                },
                {
                    field: 'owes',
                    align: 'center',
                    title: '欠/返',
                }
            ]
        };
        $.table.init(options);
    });

</script>
</body>
</html>